#ifndef __CARTE_H__
#define __CARTE_H__ 

#include <SDL.h>
#include <vector>

#include "Affichage.h"
#include "Tuile.h"
#include "Collision.h"
#include "Fichier.h"

using namespace std;

class Carte
{
	public:
		Carte(Affichage& oAffichage, Collision& oCollision, int mapID);

		bool chargerCarte(string nomCarte);
		
		void draw(int drawX, int drawY, TypeLayer layer);
		void drawBackground(int drawX, int drawY);
		void drawForeground(int drawX, int drawY);

		void gererCollision( TInfoLink& infoLink );

		TypeTuile getTypeTuile( int x, int y, SDL_Rect& recCol );
		TypeObjet getTypeObjet(int x, int y, TRecCol& recCol );

		TypeObjet soulever(int x, int y, TRecCol& recCol );
		void allumerTorche( int x, int y );

		int getLargCartePixel() { return largCartePixel; }
		int getHautCartePixel() { return hautCartePixel; }
		int getLargCarte()      { return largCarte;      }
		int getHautCarte()      { return hautCarte;      }

		~Carte();

	private:

		bool chargerBackground(string nomFichier);
		bool chargerForeground(string nomFichier);
		bool chargerCollisions(string nomFichier);

		vector<Tuile*> lstBackground;
		vector<Tuile> lstForeground;
		vector<unsigned char> lstCollisions;

		SDL_Surface* tileSet;

		int ID;

		bool bCarteChargee;
		int largCarte      , hautCarte;
		int largCartePixel , hautCartePixel;

		int largTileSet;
		int hautTileSet;

		Affichage& oAffichage;
		Collision& oCollision;
};

#endif //__CARTE_H__
